package com.kdx.cloud.common.utils;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;

/**
 * 获取指定名称的cookie的值
 * @author wubo
 * @email:wubo@kdxfilm.com
 * @date:2017年2月17日
 */
public class cookieUtil {
	public static String getCookie(HttpServletRequest request,String name){
		 
	        Cookie[] cookies = request.getCookies();  
	        if (name == null || cookies == null) {  
	            return null;  
	        }  
	        for (Cookie cookie : cookies) {  
	            if (name.equals(cookie.getName())) {  
	                return cookie.getValue();  
	            }  
	        }  
	        return null;  
	}
}
